<template>
    <div id="member">
        <!-- 引入返回导航 -->
        <mt-header title="更多功能" fixed>
            <mt-button slot="left" icon="back" @click="handleBack"></mt-button>
        </mt-header>
        
        <div class="body">
            
            <div class="list-box">
                <div class="listindex">
                    <div style="margin:0 auto;padding-top: 10px;padding-bottom: 15px;">
                    <img src="../../static/img/logo.png" style="margin:0 auto;" />
                    </div>
                </div>
                <div class="listindex">
                    <div class="right">
                        +86<input type="text" v-model="username" style="width: 80%;">
                    </div>
                </div>
                <input type="button" name="" value=" 登陆 " class="indexinput" @click="gotoUrl('member.list')">
            </div>
            <!-- 轮播图  :url="lunboUrl"-->
            <my-swipe></my-swipe>
        </div>
        <br>
        <br>
        <br>
        <br>
        <!-- 全局提示框 -->
        <div v-show="visible" style="position: fixed;background: #000; width: 100%;height: 100%;z-index: 99;top: 0px;" @click="gotovisible">
      <div class="dialog-tips dialog-center">
          <div>{{message}}</div>
      </div>
        </div>
    </div>
    
</template>

<script>
export default {
    name: 'member.login',
    data() {
        return {
            visible: false,
            message: "",
             username:'',
        }
    },
    methods: {
        handleBack(){
                this.$router.go(-1); //根据浏览器记录返回上一次
            },
        gotoUrl(url) {
            this.$ajax.get('?tbname=member_test&where=username::' + this.username)
            .then(res=>{

                if(res.data.total > 0){
                    this.message = '登陆成功';
                    this.visible = true;
                 // 命名的路由
                 this.$router.push({ name: url, params: { username: this.username }});
                }else{//let id = this.$route.query.id;
                    this.message = '未注册';
                    this.visible = true;
                }
            })
            .catch(err=>{
                console.log(err);
            })
            
        },
        gotovisible(){
            this.visible = false;
        }
    }
}
</script>

<style scoped>
.dialog-tips{
    position: fixed;
    z-index: 100;
    min-width: 220px;
    padding: 40px 22px;
    white-space: nowrap;
    background-color: #fff;
    box-shadow: 0px 8px 15px 0 rgba(0, 0, 0, 0.1);
    text-align: center;
    .dialog-tips-icon{
        width: 54px;
        height: 54px;
        @extend %bg-contain;
        display: inline-block;
        margin-bottom: 13px;
    }
}
.dialog-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%)
}
.indexinput {
        margin: 0 auto;
    border-radius: 5px;
    display: grid;
    width: 50%;
    text-align: center;
    background-color: #a3dea4;
    border: none;
    color: white;
}
.listindex ul {
    width: 100%; /*margin:0 auto;*/
}

.listindex ul li {
    float: left; width: 25%;font-size: 12px;text-align: center;
list-style:none;
}
.listindex ul li#li {
    padding-left: 10px; padding-right: 10px;float: left; width: 5%;
}

.icon-zuojiantou:before {
    color: #999;
}
/*lang="less"*/
    #member .header {
        background-color: rgba(0, 0, 0, 0.8);
        padding-bottom: 40%;
        border-radius: ~"0px 0px 50% 50% / 0px 0px 20% 20%;";
        position: relative;
    }
        #member .header .header-content {
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translateX(-50%) translateY(-50%);
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
        }
            #member .header .header-content .header-img {
                width: 80px;
                height: 80px;
                border-radius: 50%;
                background-color: #fff;
                display: flex;
                justify-content: center;
                align-items: center;
            }
                #member .header .header-content .header-img img {
                    height: 90%;
                    width: 90%;
                    border-radius: 50%;
                }
            #member .header .header-content .name {
                font-size: 15px;
                text-align: center;
                color: #fff;
            }
        #member .header .setting {
            position: absolute;
            right: 10px;
            top: 10px;
            
        }
        #member .body {
            margin-top: 50px;
        }
        
        #member .body .my-order {
            margin: 20px 0;
        }
            #member .body .my-order .order-icon {
                display: flex;
                justify-content: center;
                align-items: center;
            }
                #member .body .my-order .order-icon div {
                    flex: 1;
                    display: flex;
                    justify-content: center;
                    align-items: center;
                    flex-direction: column;
                    font-size: 12px;
                }
                    #member .body .my-order .order-icon div .svg-icon {
                        margin: 10px 0;
                    }
            #member .body .list-box .listindex:nth-child(1) , #member .body .list-box .listindex:nth-child(2) {
                margin: 10px 0;
            }
            #member .body .list-box .listindex {
               
                display: grid;
                align-items: center;
                padding: 0px 20px;
                border-radius: 3px;
                border: 1px solid #ddd;

            }
                #member .body .list-box .listindex .right {
                    padding: 20px;
                }
</style>

